Repository navigation
agg: fix -Wmaybe-uninitialized error in gradient with GCC 16 - #4
Merged
Merged
Conversation
The gradient wrapper members are constructed after the base class, so the base class cannot initialize them in its constructor. GCC 16 rejects the previous layout with -Wmaybe-uninitialized under -Werror. Store pointers initialized in the derived class constructor bodies via init_gradients() instead.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 6 6
Lines 436 425 -11
Branches 120 121 +1
=====================================
+ Misses 436 425 -11 ☔ View full report in Codecov by Harness. |
igagis
reviewed
Nov 26, 2026
igagis
reviewed
Nov 26, 2026
igagis
reviewed
Nov 26, 2026
…lass Address review: the base class only needs cur_grad. Derived classes set it in their constructor bodies and override the now-virtual set_spread_method() with their own wrappers.
igagis
reviewed
Nov 26, 2026
Address review: instead of overriding set_spread_method() in the derived classes, introduce the pure virtual protected gradient::get_spread_method_wrapper() and override it in linear_gradient and radial_gradient. The gradient wrappers are kept in a utki::enum_array indexed by gradient_spread_method (added the enum_size item to the enum). The base set_spread_method() implementation uses the new accessor.
igagis
reviewed
Nov 26, 2026
igagis
reviewed
Nov 26, 2026
igagis
reviewed
Nov 26, 2026
Address review: the spread wrappers array is now initialized in the constructor initializer list, and the constructors set the initial spread method via set_spread_method() instead of assigning cur_grad directly.
Address the CI lint failure: format the new constructor initializer lists per the project's clang-format configuration.
igagis
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GCC 16 rejects the previous
gradientbase class layout with-Wmaybe-uninitializedunder-Werror: the concrete gradient wrapper members are constructed after the base class, so the base class cannot initialize them in its constructor.The base class (AGG backend) now keeps only the
cur_gradpointer. The derived classes register their wrappers in autki::enum_arrayin their constructor bodies and override the new protected pure virtualget_spread_method_wrapper(); the baseset_spread_method()uses that accessor.Verified with a full build and the complete test suite (557 veg tests pass).